<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const d = parseInt(prompt('请输入数字'))
        alert(Math.floor(d / 100) + Math.floor(d / 10) % 10 + d % 10)
    </script>
</body>
</html>